<?php
@session_start();
/*   Description  of this file
*    Author king-of-war
*    Last Modified 2009-4-8
*    This class designed  for the news operation
*/
$root_path='./';
include_once $root_path.'head.php';
include_once $root_path."smart.inc.php";
include_once $root_path . 'admin/class/guest.class.php';
include_once $root_path . 'admin/class/cfg.class.php';
/*
* get set
*/
$cfg=new cfg($root_path);

$verify=$cfg->xml_read('guest');
/*
 * get page_num
 */
 $info="guest book";
if(isset($_POST['submit'])){
/*check captcha
*/
$cap=$_POST['captcha'];
$captcha=$_SESSION['captcha'];
	if($cap==$captcha){
/* add
*/
$name=$_POST['name'];
$intro=$_POST['intro'];
$mail=$_POST['mail'];
$guest=new guest($root_path);
$bool=$guest->guest_add(null,$name,$intro,$mail,null,$verify,1);
if($bool){
$info='Submit success';
}else{
$info='submit fail,Please try again later';
}
}
else{
$info='Captcha error';
}
}
/*
*  set templates
*/
$temp_url=$temp_url;
$smarty->assign("info",$info);
$smarty->assign("url",$temp_url);
$smarty->display("guest.html");

include_once  "foot.php";

?>